package com.springcloud.entities;

public class CommonResult <T>{
    private Integer code;
    private String message;
    private T      data;

    public Integer getCode() {
        return code;
    }
    public String getMessage() {
        return message;
    }
    public T getData() {
        return data;
    }
    public CommonResult(Integer code,String message,T data){
        this.code=code;
        this.message=message;
        this.data=data;

    }
    public CommonResult(){}//这个是无参构造
    public CommonResult(Integer code,String message){
        //下面这个就直接是调用构造方法了
        this(code,message,null);
        //就不要像下面这样去使用了
//       this.code=code;
//       this.message=message;
    }
    public CommonResult<T> setCode(Integer code) {
        this.code = code;
        return this;
    }

    public CommonResult<T> setMessage(String message) {
        this.message = message;
        return this;
    }

    public CommonResult<T> setData(T data) {
        this.data = data;
        return this;
    }
}